package com.conversationboard.model;

import java.util.ArrayList;
import java.util.List;

public class RecentlyUploadedFilesList {

	private static final int MAXIMUM_FILE_UPLOAD_LIST_SIZE = 5;
	private List<UploadedFile> files = new ArrayList<UploadedFile>(MAXIMUM_FILE_UPLOAD_LIST_SIZE);


	public void add(UploadedFile file) {

		this.files.add(0, file);

		if (this.files.size() > MAXIMUM_FILE_UPLOAD_LIST_SIZE) {
			this.files.remove(this.files.size() - 1);
		}
	}


	public List<UploadedFile> getRecentlyUploadedFilesList() {
		return this.files;
	}


	void print() {
		for (UploadedFile file : files) {
			System.out.println(file.getOriginalFileName());
		}
	}

}
